﻿Jxstar.currentPage = function() {
	var config = {param:{},initpage:function(page, define){},eventcfg:{}};
	
		var items = [{
		border:false,
		layout:'form',
		autoHeight:true,
		cls:'x-form-main',
		items:[{
			anchor:'100%',
			border:false,
			layout:'column',
			autoHeight:true,
			items:[{
				border:false,
				columnWidth:0.33,
				layout:'form',
				items:[
					{xtype:'datefield', fieldLabel:'截取时间', name:'rest_tnt__tnt_date', format:'Y-m-d H:i:s', anchor:'100%', readOnly:true},
					{xtype:'hidden', fieldLabel:'主键', name:'rest_tnt__tnt_id', anchor:'100%'}
				]
			},{
				border:false,
				columnWidth:0.33,
				layout:'form',
				items:[
					{xtype:'hidden', fieldLabel:'功能ID', name:'rest_tnt__fun_id', anchor:'100%'}
				]
			},{
				border:false,
				columnWidth:0.33,
				layout:'form',
				items:[
					{xtype:'textfield', fieldLabel:'事件代号', name:'rest_tnt__event_code', readOnly:true, anchor:'100%', maxLength:50}
				]
			}
			]
		},{
			anchor:'100%',
			border:false,
			layout:'column',
			autoHeight:true,
			items:[{
				border:false,
				columnWidth:0.99,
				layout:'form',
				items:[
					{xtype:'textfield', fieldLabel:'访问URL', name:'rest_tnt__req_url', anchor:'100%', maxLength:200},
					{xtype:'textarea', fieldLabel:'请求数据', name:'rest_tnt__req_data', anchor:'100%', height:150, maxLength:1000}
				]
			}
			]
		},{
			anchor:'100%',
			border:false,
			layout:'column',
			autoHeight:true,
			items:[{
				border:false,
				columnWidth:0.99,
				layout:'form',
				items:[
					{xtype:'textarea', fieldLabel:'响应数据', name:'rest_tnt__out_data', anchor:'100%', height:240, maxLength:2000}
				]
			}
			]
		}]
	}];
	
	config.param = {
		items: items,
		funid: 'rest_tnt'
	};

	config.param.formWidth = '100%';

	config.eventcfg = {
        testRest: function() {
			var keyid = this.getPkField().getValue();
			if (keyid.length == 0) {
				JxHint.alert(jx.event.nosave);
				return;
			}
			
            var params = 'funid=rest_tnt&eventcode=testrest&keyid='+keyid;
			
            //发送请求
			Request.postRequest(params, null);
        }
	};
	
	return new Jxstar.FormNode(config);
}